import request from "@/utils/request";

// 获取分类列表
export function getCategories(params) {
  return request({
    url: "/category/page",
    method: "get",
    params,
  });
}

// 新增分类
export function addCategory(data) {
  return request({
    url: "/category",
    method: "post",
    data,
  });
}

// 编辑分类
export function updateCategory(data) {
  return request({
    url: `/category`,
    method: "put",
    data, // 修改后的分类数据
  });
}

// 删除分类
export function deleteCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: "delete",
  });
}
